import request from '@/config/axios'

// webhook VO
export interface WebhookVO {
  name: string // 名称
  type: string // 类型
  url: string // 地址
}

// webhook API
export const WebhookApi = {
  // 查询webhook分页
  getWebhookPage: async (params: any) => {
    return await request.get({ url: `/vmiot/webhook/page`, params })
  },

  // 查询webhook详情
  getWebhook: async (id: number) => {
    return await request.get({ url: `/vmiot/webhook/get?id=` + id })
  },

  // 新增webhook
  createWebhook: async (data: WebhookVO) => {
    return await request.post({ url: `/vmiot/webhook/create`, data })
  },

  // 修改webhook
  updateWebhook: async (data: WebhookVO) => {
    return await request.put({ url: `/vmiot/webhook/update`, data })
  },

  // 删除webhook
  deleteWebhook: async (id: number) => {
    return await request.delete({ url: `/vmiot/webhook/delete?id=` + id })
  },

  // 导出webhook Excel
  exportWebhook: async (params) => {
    return await request.download({ url: `/vmiot/webhook/export-excel`, params })
  }
}